﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ModelLayer;

namespace GUILayer
{
    public partial class GUISaleBookingPopup : Form
    {
        List<Sale> salesList;
        public GUISaleBookingPopup(List<Sale> salesList)
        {
            InitializeComponent();
            this.salesList = salesList;
            
        }

        private void buttonSaleBookingPopupOK_Click(object sender, EventArgs e)
        {
            if (!(comboBoxSaleBookingPopupChooseShow.SelectedIndex < 0))
            {
                Sale s = (Sale)comboBoxSaleBookingPopupChooseShow.SelectedItem;
                int indexToKeep = salesList.IndexOf(s);

                int i = 0;
                while (i < salesList.Count)
                {
                    if(i != indexToKeep)
                    {
                        salesList.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }

                }
            }
        }

        
    }
}
